package org.budo.support.spring.io.util;

import java.io.IOException;
import java.io.InputStream;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.InputStreamSource;

/**
 * @author limingwei
 * @date 2016年6月7日 上午9:57:32
 * 
 * @deprecated org.budo.support.spring.io.util.ResourceUtil
 */
public class InputStreamSourceUtil {
    public static InputStream getInputStream(InputStreamSource inputStreamSource) {
        try {
            return inputStreamSource.getInputStream();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static InputStream getClassPathInputStream(String path) {
        ClassPathResource inputStreamSource = new ClassPathResource(path);
        return getInputStream(inputStreamSource);
    }
}